package net.optix.ip.business
{
	import com.adobe.cairngorm.business.Responder;
	
	import mx.rpc.http.HTTPService;
	
	import net.optix.ip.model.ModelLocator;
	import net.optix.ip.vo.UpdateServiceVO;
	
	public class ManagerDelegate
	{
		private var responder:Responder;
		private var service:HTTPService;
		
		public function	listener():void
		{
			service.method = "POST";
            service.resultFormat	=	HTTPService.RESULT_FORMAT_E4X;
            service.addEventListener("result", responder.onResult);
            service.addEventListener("fault", responder.onFault);
		}

		public function getOrderFirms(responder:Responder):void
		{
			this.responder	=	responder;
			service 		= 	new HTTPService();
			service.url		=	ModelLocator.getInstance().url+"/Manager/GetOrderFirms";
            this.listener();
            //service.resultFormat	=	HTTPService.RESULT_FORMAT_TEXT;
            service.send({
            	
            });
		}
		
		public function updateService(responder:Responder,vo:UpdateServiceVO):void
		{
			this.responder	=	responder;
			service 		= 	new HTTPService();
			service.url		=	ModelLocator.getInstance().url+"/Manager/UpdateService";
            this.listener();
            trace("userID is   "+vo.userID+"    role is   "+vo.role);
            //service.resultFormat	=	HTTPService.RESULT_FORMAT_TEXT;
            service.send({
            	UserID:vo.userID,
            	Role:vo.role
            });
		}
	}
}